<?php /*a:2:{s:55:"/www/wwwroot/mall/public/template/mall/index/index.html";i:1627868409;s:64:"/www/wwwroot/mall/public/template/mall/../index/public/mlay.html";i:1624501447;}*/ ?>
<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="x-ua-compatible" content="ie=edge">
		<title><?php echo htmlentities((isset($page_title) && ($page_title !== '')?$page_title:config('app.web_site_title'))); ?></title>
		<meta name="keywords" content="<?php echo config('app.web_site_keywords'); ?>">
		<meta name="description" content="<?php echo config('app.web_site_description'); ?>">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, shrink-to-fit=no, user-scalable=no">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		
		
		<!-- Icons -->
		<link rel="icon" href="/static/images/favicon.ico">
		<!-- END Icons -->
		
		<!-- Stylesheets -->
		<link rel="stylesheet" href="/static/libs/weui/css/weui.min.css">
		<link rel="stylesheet" href="/static/libs/weui/css/common.css?v=<?php echo config('app.asset_version'); ?>">
		<link rel="stylesheet" href="/static/css/font/iconfont.css?v=<?php echo config('app.asset_version'); ?>">
		<!-- END Stylesheets -->
		
<style>
	.main {
		flex-wrap: wrap;
		padding: 0.5rem 0.5rem;
		border-radius: 10px;
		margin-top: 10px;
	}

	.main_box {
		flex: 0 0 50%;
		padding: 0 0.5rem;
		margin-bottom: 0.5rem;
		border-radius: 0.5rem;
		padding-bottom: 0.5rem;
	}

	.main_box_detail {
		overflow: hidden;
		height: 5rem;
		background: #fff;
		position: relative;
	}

	.add_car {
		width: 0.75rem;
		height: 0.75rem;
	}

	.box_img {
		border-radius: 0.5rem;
		height: 5rem;
		border-radius: 0.4rem;
		display: block;
		margin: 0 auto;
	}

	.box_div {
		font-size: 0.75rem;
		color: #333333;
	}

	.add-cart {
		border-radius: 30px;
		background: #a78928;
		text-align: center;
		color: #fff;
		margin: 0rem 3rem;
		padding: 0.5rem 2rem;
		font-size: 0.8rem;
	}

	.cover_img {
		width: 3rem;
		height: 3rem;
		border-radius: 10px;
		margin-right: 0.5rem;
	}

	.van-stepper--round .van-stepper__plus {
		background-color: #a78928 !important;
	}

	.van-stepper--round .van-stepper__minus {
		color: #a78928 !important;
		border: 1px solid #a78928 !important;
	}

	.goods_title {
		font-size: 0.75rem;
		/* color: #fff; */
		/* position: absolute; */
		/* bottom: 0; */
		/* background: rgba(0, 0, 0, 0.5); */
		width: 100%;
		text-align: center;
		display: -webkit-box;
		overflow: hidden;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}
</style>
<!-- 公共css样式在这里 弹性布局也在这里 -->
<link rel="stylesheet" href="/template/static/css/public.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.12/lib/index.css" />

	</head>
	<body id="<?php echo htmlentities(strtolower(app('request')->app())); ?>-<?php echo htmlentities(strtolower(app('request')->controller())); ?>-<?php echo htmlentities(strtolower(app('request')->action())); ?>">
		<!-- Page Container -->
		<div class="page" id="main">
			
			
<input style="display: none;" class="tabShow" value="0" />
<div id="app">
	<van-swipe style="margin: 0.5rem;height:150px;" :show-indicators='false' :autoplay="3000">
		<van-swipe-item v-cloak v-for="(list, index) in slider" :key="index">
			<a :href="list.url">
				<img style="width: 100%;height: 100%;" v-cloak v-lazy="list.image" />
			</a>
		</van-swipe-item>
	</van-swipe>
	<van-notice-bar left-icon="volume-o" scrollable background="#f5f5f5" :text="notify"></van-notice-bar>
	<div class="flex ju_sb tc" style="padding: 0 0.5rem;">
		<div @click="click_tab(item.url)" v-cloak v-for="(item,index) in list" :key="index">
			<img style="width: 2.2rem;height: 2.2rem;" :src="item.logo">
			<div style="font-size: 0.75rem;" v-cloak>{{item.title}}</div>
		</div>
	</div>
	<div class="flex ju_sb bagfff main">
		<div class="main_box" v-for="(item,index) in Data" :key="index">
			<div style="background: #f8f8f8;border: 0.2rem solid #f8f8f8;border-radius: 10px;" class="">
				<div @click="details(item.id)" class="main_box_detail">
					<img class="box_img" v-cloak :src="item.cover">
					<!-- <div class="goods_title" class="box_div" v-cloak>{{item.title}}</div> -->
				</div>
				<div class="box_div goods_title" v-cloak>{{item.title}}</div>
				<div class="flex ju_sb ai_center" style="padding: 0 0.5rem;">
					<div style="color: #a88b2c;font-size: 0.7rem;">
						￥<span style="font-size: 0.95rem;" v-cloak>{{item.price}}</span>
					</div>
					<img @click="add_car(item,item.id)" class="add_car" src="/template/static/img/cart_img.png">
				</div>
			</div>
		</div>
	</div>
	<van-popup position="bottom" round :style="{ height: '40%' }" v-model="show">
		<div v-show="show" style="padding: 1rem 1rem;display: none;" class="">
			<div class="flex">
				<img class="cover_img" v-cloak :src="cover">
				<div class="">
					<div v-cloak>{{title}}</div>
					<div style="color: #a78928;" v-cloak>{{price}}元</div>
				</div>
			</div>
			<p style="padding: 0.5rem 0;font-size: 0.8rem;">
				备注:
				<input v-model="note" type="text" placeholder="请输入" value="" />
			</p>
			<van-stepper @change="stepper" v-model="value" theme="round" button-size="22" disable-input></van-stepper>
		</div>
		<div @click="add" v-show="show" style="display: none;" class="add-cart">
			添加购物车
		</div>
	</van-popup>
</div>

		</div>
		<!-- END Page Container -->
		<!-- FOOT -->
		
		<!-- Copyright -->
		<div class="weui-footer padding-tb">
			<!-- 		<p class="weui-footer__links">
	<a href="javascript:void(0);" class="weui-footer__link">底部链接</a>
	</p> -->
			<p class="weui-footer__text"><?php echo config('app.web_site_copyright'); ?></p>
		</div>
		<!-- Copyright -->
		
		
		<!-- Footer -->
		<!-- 工具栏 -->
		<div class="footer"></div>
		<?php if(!(empty($nav['main_nav']) || (($nav['main_nav'] instanceof \think\Collection || $nav['main_nav'] instanceof \think\Paginator ) && $nav['main_nav']->isEmpty()))): ?>
		<nav class="bar-tab weui-flex">
			<?php if(is_array($nav['main_nav']) || $nav['main_nav'] instanceof \think\Collection || $nav['main_nav'] instanceof \think\Paginator): $i = 0; $__LIST__ = $nav['main_nav'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?>
			<a class="tab-item weui-flex__item<?php if(isset($active) && $active == $menu['rel']): ?> active<?php endif; ?>" href="<?php echo htmlentities($menu['url']); ?>">
				<span class="icoimg <?php echo htmlentities($menu['css']); if(isset($active) && $active == $menu['rel']): ?>-full<?php endif; ?>"></span>
				<span class="tab-label"><?php echo htmlentities($menu['title']); ?></span>
			</a>
			<?php endforeach; endif; else: echo "" ;endif; ?>
		</nav>
		<?php endif; ?>
		<!-- Footer -->
		

		
		<ul id="Fixed">
			<li id="goTop" class="ico ico-up hidden" title="去顶部"></li>
		</ul>
		
		<!-- END FOOT-->
		<div class="hidden">
			
			<?php echo config('app.web_site_statistics'); ?>
			
		</div>
		<!--js -->
		<script src="/static/libs/weui/js/jquery.min.js"></script>
		<script src="/static/libs/weui/js/weui.min.js"></script>
		<script src="/static/libs/weui/js/common.js?<?php echo config('app.asset_version'); ?>"></script>
		
		<?php if(!(empty($jssdk) || (($jssdk instanceof \think\Collection || $jssdk instanceof \think\Paginator ) && $jssdk->isEmpty()))): ?>
		<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
		<script>
			wx.config({
				debug: false,
				appId: '<?php echo htmlentities($jssdk['appid']); ?>',
				timestamp: '<?php echo htmlentities($jssdk['timestamp']); ?>',
				nonceStr: '<?php echo htmlentities($jssdk['noncestr']); ?>',
				signature: '<?php echo htmlentities($jssdk['signature']); ?>',
				jsApiList: [
					'updateAppMessageShareData',
					'updateTimelineShareData',
					'hideMenuItems',
					'showMenuItems',
					'closeWindow',
				],
				openTagList: ['wx-open-launch-weapp']
			});
			wx.ready(function() {
				wx.updateAppMessageShareData({
					title: "<?php echo htmlentities((isset($share['title']) && ($share['title'] !== '')?$share['title']:config('app.web_site_title'))); ?>", // 分享标题
					desc: "<?php echo htmlentities((isset($share['desc']) && ($share['desc'] !== '')?$share['desc']:config('app.web_site_slogan'))); ?>", // 分享描述
					link: "<?php echo htmlentities((isset($share['url']) && ($share['url'] !== '')?$share['url']:$jssdk['url'])); ?>", // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
					imgUrl: "<?php echo htmlentities((isset($share['img']) && ($share['img'] !== '')?$share['img']:app('request')->scheme() . '://' .app('request')->host() .'/static/images/share.png')); ?>", // 分享图标
					success: function() {
						// 设置成功
					}
				});
				wx.updateTimelineShareData({
					title:  "<?php echo htmlentities((isset($share['title']) && ($share['title'] !== '')?$share['title']:config('app.web_site_title'))); ?>", // 分享标题
					link: "<?php echo htmlentities((isset($share['url']) && ($share['url'] !== '')?$share['url']:$jssdk['url'])); ?>", // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
					imgUrl: "<?php echo htmlentities((isset($share['img']) && ($share['img'] !== '')?$share['img']:app('request')->scheme() . '://' .app('request')->host() .'/static/images/share.png')); ?>", // 分享图标
					success: function() {
						// 设置成功
					}
				});
				<?php if(!(empty($share['hide']) || (($share['hide'] instanceof \think\Collection || $share['hide'] instanceof \think\Paginator ) && $share['hide']->isEmpty()))): ?>
				wx.hideMenuItems({
					menuList: ['menuItem:copyUrl', 'menuItem:originPage', 'menuItem:readMode', 'menuItem:openWithQQBrowser',
						'menuItem:openWithSafari', 'menuItem:share:email', 'menuItem:favorite', 'menuItem:share:qq',
						'menuItem:share:weiboApp', 'menuItem:favorite', 'menuItem:share:QZone'] // 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
				});
				<?php endif; ?>
				wx.showMenuItems({
					menuList: ["menuItem:profile", "menuItem:addContact", ] // 要显示的菜单项，所有menu项见附录3
				});
			});
		</script>
		<?php endif; ?>
		
		
<!-- 引入vue.js文件使用vue开发 -->
<script src="/template/static/js/public/vue.min.js" type="text/javascript" charset="utf-8"></script>
<!-- vant -->
<script src="/template/static/js/public/vant-2.12.min.js" type="text/javascript" charset="utf-8"></script>
<script>
	Vue.use(vant.Lazyload);
	var index = new Vue({
		el: "#app",
		data() {
			return {
				notify: "<?php echo app_config('mall', 'notify'); ?>",
				value: '',
				show: false,
				id: '', //商品id
				cover: '',
				title: '',
				price: '',
				logo: '',
				item: '数据',
				slider: <?php echo json_encode($slider); ?>,
				list: <?php echo json_encode($category); ?>, 
				Data: [],
				note: '', //备注
			}
		},
		//计算属性
		computed: {},
		//监听属性
		watch: {},
		//钩子函数
		created() {
			// this.ceshi()
			this.goods()
		},
		mounted() {
			// vant.Toast('轻提示');
		},
		methods: {
			goods() {
				let that = this
				var loading = weui.loading('loading', {
					content: '正在载入'
				});
				$.get("<?php echo real_url('mall/goods/index',['model' => 'index']); ?>", function(res) {
					that.Data = res.data.items
					loading.hide();
				})
			},
			details(id) { //商品详情
				// console.log(id);
				window.location.href = "<?php echo real_url('mall/goods/detail'); ?>/id/" + id
			},
			click_tab(url) { //tab切换
				window.location.href = url
			},
			stepper(e) {
				console.log(e);
			},
			add_car: function(item, id) {
				// console.log('购物车', item)
				this.cover = item.cover
				this.title = item.title
				this.price = item.price
				this.logo = item.logo
				this.id = id
				this.show = true;
				this.value = 1
			},
			add: function() {
				this.show = false
				$.post("<?php echo url('mall/cart/add'); ?>", {
					gid: this.id,
					nums: this.value,
					remark: this.note,
				}, function(res) {
					// console.log(res);
					if (res.code == 1) {
						vant.Toast.success('添加成功');
					} else {
						vant.Toast.fail(res.msg);
					}

				});
			}
		}
	})
</script>

	</body>
</html>
